-
Notifications
You must be signed in to change notification settings - Fork 1
Rule #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Возможно, этот критерий должен подсчитывать нечто иное, а не количечтво логических логических бинарных операций
Думаю, пока сойдёт количество бинарных операций
К слову, вся система постепенно создает проблемы. Для добавления новых критериев придется каждый раз редактировать CMakeLists.txt, tester.py и бог знает что еще.
CMakeLists.txt
всё равно придётся редактировать, wildcards не очень признаны, поэтому нужно каждый файлик осмысленно добавить в сборку. tester.py
переродиться во что-нибудь другое (я так думаю), поэтому с ним проблема уйдёт
rules/TooComplexConditionRule.cpp
Outdated
for (Stmt::child_iterator child = stmt->child_begin(); child != stmt->child_end(); child++) { | ||
result += getStmtComplexity(*child); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Заменить на использование цикла for each
- Желательно заменить рекурсию на цикл
rules/TooComplexConditionRule.cpp
Outdated
using namespace std; | ||
using namespace clang; | ||
using namespace oclint; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исправить аналогично #9
rules/TooComplexConditionRule.cpp
Outdated
.. code-block:: cpp | ||
|
||
void example() | ||
{ | ||
// TODO: modify the example for this rule. | ||
} | ||
)rst"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Кажется, сюда надо бы добавить какой-то простой пример
TooComplexCondition.
Реализация этого критерия.
Подсчитывает количество логических бинарных операций в условии. Если их количество превышает некоторую константу, значит автору кода стоит это исправить. Возможно, этот критерий должен подсчитывать нечто иное, а не количечтво логических логических бинарных операций. ???? \_/(0_0)\_/
К слову, вся система постепенно создает проблемы. Для добавления новых критериев придется каждый раз редактировать CMakeLists.txt, tester.py и бог знает что еще.
У меня есть идеи, как это решить, но они, похоже, подождут разрешения вопроса с предыдущим PR (ветка new).